package com.hao.wms.domain;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SystemMenu extends BaseDomain implements IJsonObject{
    private String name;
    private String url;
    private String sn;
    private SystemMenu parent;
    private List<SystemMenu> children = new ArrayList<>();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    public SystemMenu getParent() {
        return parent;
    }

    public void setParent(SystemMenu parent) {
        this.parent = parent;
    }

    public List<SystemMenu> getChildren() {
        return children;
    }

    public void setChildren(List<SystemMenu> children) {
        this.children = children;
    }

    @Override
    public Object toJson() {
        Map<String,Object> json = new HashMap<>();
        json.put("id",id);
        json.put("name",name);
        json.put("action",url);
        json.put("pId",parent==null?null:parent.getId());
        return json;
    }
}
